<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Expires" content="0">
<head></head>
<title>Orange Java Framework</title>
<link rel="stylesheet" href="resources/css/tree.css" type="text/css">
<script src="script/tree.js"></script>
<body class="navtree">
	<f:view>
		<h:form id="myForm">
			<script>
				d = new dTree('d');
				<c:forEach var="the" items="${sessionScope.currentUserMenus}" varStatus="status">
				<c:url value="${the.menu_code}" var="code" />
				<c:url value="${the.menu_name}" var="name" />
				<c:url value="${the.labelText}" var="label" />
				<c:url value="${the.parent.menu_code}" var="parent" />
				<c:url value="${the.encodeURL}" var="url" />

				<c:choose>
				<c:when test="${status.count eq 1}" >
				d.add('<c:out value="${code}" />', -1,
						'<c:out value="${label}" />',
						'<c:out value="${url}" />',
						'<c:out value="${name}" />', 'detail');
				</c:when>
				<c:otherwise>
				d.add('<c:out value="${code}" />',
						'<c:out value="${parent}" />',
						'<c:out value="${label}" />',
						'<c:out value="${url}" />',
						'<c:out value="${name}" />', 'detail');
				</c:otherwise>
				</c:choose>
				</c:forEach>
			</script>

			<table border="0" cellpadding="0" cellspacing="0" width="100%">
				<tr valign="top">
					<td><script>
						document.write(d);
						d.openAll();
					</script></td>
				</tr>
			</table>

		</h:form>
	</f:view>
</body>
</html>
